home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11654 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.spb.su!KremlSun!glukr!glukr!not-for-mail
  2. From: "Igor A. Krivokon" <igor@vsi.kiev.ua>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: works in Borland but not in Microsuck Visual C++
  5. Date: 15 Mar 1996 16:27:13 +0200
  6. Organization: Private person
  7. Sender: news@render.gu.kiev.ua
  8. Distribution: world
  9. Message-ID: <AB-zMInOhJ@vsi.kiev.ua>
  10. References: <4ia6h8$jes@news.vanderbilt.edu>
  11. Reply-To: igor@vsi.kiev.ua
  12. NNTP-Posting-Host: news@render.gu.kiev.ua
  13. X-Return-Path: vsi!vsi.kiev.ua!igor@creator.gu.kiev.ua
  14.  
  15. Bennett Haselton (haseltbt@ctrvax.vanderbilt.edu) writes:
  16.  
  17. >               The following program was written in completely standard C++
  18. >and should be portable across platforms.  However, it only performs as
  19. >expected (i.e. sends two copies of 4 to the standard out stream) in Borland
  20. >C++; when compiled in MicroSUCK Visual C++, it outputs 4 followed by a random
  21. >integer in the thousands.
  22. >
  23. >#include <iostream.h>
  24. >
  25. >struct person {
  26. >       int age;
  27. >};
  28. >
  29. >struct person* matchPerson( struct person* psnPtr )
  30. >{
  31. >       struct person* ansPtr;
  32. >       ansPtr->age = psnPtr->age;
  33.         ^^^^^^^^^^^^^^^^^^^^^^^^^^
  34. You should allocate memory for object (struct) before you use it!
  35.  
  36. [skipped]
  37.  
  38. >
  39. >i was using version 1.0 of Visual C++; i have no knowledge of whether later
  40. >Microsuck compilers are capable of handling a program like this properly.
  41.  
  42. I doubt :)
  43.  
  44. >Please avoid buying their products whenever possible if you have not already
  45. >resolved to do so.
  46.  
  47. Please avoid to judge hastily.
  48.  
  49. >
  50. >       Love,
  51. >
  52. >               tm
  53. >       -bennett
  54. >
  55.  
  56. Yours,
  57.  
  58. Igor Krivokon
  59.  
  60.  
  61.